﻿<!--
  ~ Copyright (c) 2020-present LiuDanYang All rights Reserved.
  -->

<!DOCTYPE html>
<html lang="zh">
<head>
  <script>/*@cc_on window.location.href="https://support.dmeng.net/upgrade-your-browser.html?referrer="+encodeURIComponent(window.location.href); @*/</script>
  <meta charset="utf-8">
  <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
  <meta content="webkit" name="renderer">
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <meta content="520 我爱你" name="keywords"/>
  <meta content="520 我爱你" name="description"/>
  <meta content="LiuDanYang" name="author"/>
  <meta content="index,follow" name="robots"/>
  <title>2019-520 我爱你们</title>
  <link type="text/css" rel="stylesheet" href="./js/default.css">
  <style type="text/css">
  .STYLE1 {
    color: #666666
  }
  </style>
  <!-- Google Tag Manager -->
  <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-53N4387');</script>
  <!-- End Google Tag Manager -->
  <script src="https://www.googleoptimize.com/optimize.js?id=OPT-KG9LMM6"></script>
</head>

<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-53N4387" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<noscript>
  <strong>很抱歉，如果不启用JavaScript，将无法正常使用。 请启用它以继续。</strong>
</noscript>

<audio autoplay>
  <source src="renxi.mp3" type="audio/mp3"/>
</audio>

<div id="main">
  <div id="wrap">
    <div id="text">
      <div id="code">
        <font color="#FF0000">
          <span class="say">亲爱的爸爸、妈妈、老弟，我爱你们。</span><br>
          <span class="say"> </span><br>
          <span class="say">我知道我不会甜言蜜语，但是我会用行动证明一切</span><br>
          <span class="say"> </span><br>
          <span class="say">不管你们身在哪里，我的心陪伴着你们；</span><br>
          <span class="say"> </span><br>
          <span class="say">不管你们将去何方，我的爱追随着你们。</span><br>
          <span class="say"> </span><br>
          <span class="say">千山万水亦何妨，就是爱你们到天荒。</span><br>
          <span class="say"> </span><br>
          <span class="say">在520我爱你这个特别的日子里，特别的爱送给特别的你，特别的祝福送给特别的爱。</span><br>
          <span class="say"> </span><br>
          <span class="say">愿我爱的你们永远开开心心！</span><br>
          <span class="say"> </span><br>
          <span class="say">
            <span class="space"></span>
            --爱你们的刘丹阳--
          </span>
        </font>
      </div>
    </div>
    <div id="clock-box">
      <span class="STYLE1"></span>
      <font color="#33CC00">亲爱的爸爸、妈妈、老弟，我爱你们</font>
      <span class="STYLE1">已经是……</span>
      <div id="clock"></div>
    </div>
    <canvas id="canvas" width="1100" height="680"></canvas>
  </div>
</div>

<script type="text/javascript" src="./js/jquery.min.js"></script>
<script type="text/javascript" src="./js/jscex.min.js"></script>
<script type="text/javascript" src="./js/jscex-parser.js"></script>
<script type="text/javascript" src="./js/jscex-jit.js"></script>
<script type="text/javascript" src="./js/jscex-builderbase.min.js"></script>
<script type="text/javascript" src="./js/jscex-async.min.js"></script>
<script type="text/javascript" src="./js/jscex-async-powerpack.min.js"></script>
<script type="text/javascript" src="./js/functions.js" charset="utf-8"></script>
<script type="text/javascript" src="./js/love.js" charset="utf-8"></script>
<script type="text/javascript">
(function() {
  var canvas = $('#canvas');

  if (!canvas[0].getContext) {
    $("#error")
    .show();
    return false;
  }

  var width = canvas.width();
  var height = canvas.height();
  canvas.attr("width", width);
  canvas.attr("height", height);
  var opts = {
    seed: {
      x: width / 2 - 20,
      color: "rgb(190, 26, 37)",
      scale: 2
    },
    branch: [
      [
        535, 680, 570, 250, 500, 200, 30, 100, [
        [
          540, 500, 455, 417, 340, 400, 13, 100, [
          [450, 435, 434, 430, 394, 395, 2, 40]
        ]
        ],
        [
          550, 445, 600, 356, 680, 345, 12, 100, [
          [578, 400, 648, 409, 661, 426, 3, 80]
        ]
        ],
        [539, 281, 537, 248, 534, 217, 3, 40],
        [
          546, 397, 413, 247, 328, 244, 9, 80, [
          [427, 286, 383, 253, 371, 205, 2, 40],
          [498, 345, 435, 315, 395, 330, 4, 60]
        ]
        ],
        [
          546, 357, 608, 252, 678, 221, 6, 100, [
          [590, 293, 646, 277, 648, 271, 2, 80]
        ]
        ]
      ]
      ]
    ],
    bloom: {
      num: 700,
      width: 1080,
      height: 650,
    },
    footer: {
      width: 1200,
      height: 5,
      speed: 10,
    }
  }

  var tree = new Tree(canvas[0], width, height, opts);
  var seed = tree.seed;
  var foot = tree.footer;
  var hold = 1;

  canvas.click(function(e) {
    var offset = canvas.offset(), x, y;
    x = e.pageX - offset.left;
    y = e.pageY - offset.top;
    if (seed.hover(x, y)) {
      hold = 0;
      canvas.unbind("click");
      canvas.unbind("mousemove");
      canvas.removeClass('hand');
    }
  })
  .mousemove(function(e) {
    var offset = canvas.offset(), x, y;
    x = e.pageX - offset.left;
    y = e.pageY - offset.top;
    canvas.toggleClass('hand', seed.hover(x, y));
  });

  var seedAnimate = eval(Jscex.compile("async", function() {
    seed.draw();
    while (hold) {
      $await(Jscex.Async.sleep(10));
    }
    while (seed.canScale()) {
      seed.scale(0.95);
      $await(Jscex.Async.sleep(10));
    }
    while (seed.canMove()) {
      seed.move(0, 2);
      foot.draw();
      $await(Jscex.Async.sleep(10));
    }
  }));

  var growAnimate = eval(Jscex.compile("async", function() {
    do {
      tree.grow();
      $await(Jscex.Async.sleep(10));
    } while (tree.canGrow());
  }));

  var flowAnimate = eval(Jscex.compile("async", function() {
    do {
      tree.flower(2);
      $await(Jscex.Async.sleep(10));
    } while (tree.canFlower());
  }));

  var moveAnimate = eval(Jscex.compile("async", function() {
    tree.snapshot("p1", 240, 0, 610, 680);
    while (tree.move("p1", 500, 0)) {
      foot.draw();
      $await(Jscex.Async.sleep(10));
    }
    foot.draw();
    tree.snapshot("p2", 500, 0, 610, 680);

    // 会有闪烁不得意这样做, (＞﹏＜)
    canvas.parent()
    .css("background", "url(" + tree.toDataURL('image/png') + ")");
    canvas.css("background", "#ffe");
    $await(Jscex.Async.sleep(300));
    canvas.css("background", "none");
  }));

  var jumpAnimate = eval(Jscex.compile("async", function() {
    var ctx = tree.ctx;
    while (true) {
      tree.ctx.clearRect(0, 0, width, height);
      tree.jump();
      foot.draw();
      $await(Jscex.Async.sleep(25));
    }
  }));

  var textAnimate = eval(Jscex.compile("async", function() {
    var together = new Date();
    together.setFullYear(1996, 12, 4); 			//时间年月日
    together.setHours(0);						//小时
    together.setMinutes(0);					//分钟
    together.setSeconds(0);					//秒前一位
    together.setMilliseconds(2);				//秒第二位

    $("#code")
    .show()
    .typewriter();
    $("#clock-box")
    .fadeIn(500);
    while (true) {
      timeElapse(together);
      $await(Jscex.Async.sleep(1000));
    }
  }));

  var runAsync = eval(Jscex.compile("async", function() {
    $await(seedAnimate());
    $await(growAnimate());
    $await(flowAnimate());
    $await(moveAnimate());

    textAnimate()
    .start();

    $await(jumpAnimate());
  }));

  runAsync()
  .start();
})();
</script>

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-VSP9NSEKD9"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-VSP9NSEKD9');
</script>

</body>
</html>
